package main

import "fmt"

type Person struct {
	name string
	age  int
	id   int
}

func main() {

	// 创建一个新的结构体
	fmt.Println(Person{"Go 语言", 1, 6495407})

	// 创建一个新的结构体
	fmt.Println(Person{name: "Go 语言", age: 1, id: 6495407})

	// 忽略的字段为 0 或 空
	fmt.Println(Person{name: "Go 语言"})

	var Person1 Person
	var Person2 Person

	Person1.age = 1
	Person1.name = "xt"
	Person1.id = 1111

	Person2.age = 2
	Person2.name = "xt2"
	Person2.id = 2222

	fmt.Printf("Person1  name : %s\n", Person1.name)

	fmt.Printf("Person2  age : %d\n", Person2.age)

	printPerson(Person1)

	printPerson2(&Person2)

}

func printPerson(person Person) {
	fmt.Printf("Person  name : %s\n", person.name)
}

func printPerson2(person *Person) {
	fmt.Printf("Person  name : %s\n", person.name)

}
